package com.dkd;
import com.dkd.framework.web.domain.server.Sys;
import lombok.extern.slf4j.Slf4j;
import org.dromara.x.file.storage.spring.EnableFileStorage;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableAsync;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
/**
 * 启动程序
 *
 * @author ruoyi
 *
 */
@EnableFileStorage
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.dkd.*"})
@EnableAsync
@Slf4j
public class DkdApplication {
    public static void main(String[] args) {
        System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(DkdApplication.class, args);
    }
    @EventListener(ApplicationReadyEvent.class)
    public void onApplicationReady(ApplicationReadyEvent event) {
        try {
            InetAddress localhost = InetAddress.getLocalHost();
            System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>> ApplicationReadyEvent: 项目启动成功，访问地址: http://" + localhost.getHostAddress() + ":" + event.getApplicationContext()
                    .getEnvironment()
                    .getProperty("server.port") + "/ <<<<<<<<<<<<<<<<<<<<<<<<<<<");
        } catch (UnknownHostException e) {
            System.err.println("无法获取本地主机地址:" + e);
        }
    }
}
